<form action="" method="post">
    关键字：<input type="text" name="keyworld">
    <input type="submit" name="sub" value="查找">
</form>
<?php
/**
 * User: lie
 * Date: 2020/12/4 16:32
 * Title: 通过正则表达式对字符串进行匹配查找
 * Description:
 * Error:
 */
$arr = array("mrsoft", "明日mr科技","www.mrsoft.com");
foreach ($arr as $value) {
    if ($_POST['sub']) {
        $keyworld = $_POST['keyworld'];
        if (preg_match("/$keyworld/", $value)) {
            echo $value;
            echo "<br>";
        }
    }
}
